/**
 * Created by lx on 2017/10/9.
 */
angular.module('service.tablegroup', [
        "ngResource",
    ])
    .service('TableGroupService', TableGroupService);
TableGroupService.$inject = ['$resource'];
function TableGroupService($resource) {

    // 通过shopid添加桌台
    this.addTableGroup = function (table, sucF, errF) {
        var resource = $resource(merchanturl + "shopgroup");
        return resource.save(table, sucF, errF);
    };

    this.getGroupByShopId = function (shopid, success, error) {
        var resource = $resource(merchanturl + "shopgroup/byshopid/:shopid");
        return resource.query({shopid: shopid}, success, error);
    };

    this.getGroupByGroupId = function (groupid, success, error) {
        var resource = $resource(merchanturl + "shopgroup/:groupid");
        return resource.query({groupid: groupid}, success, error);
    };

    this.deleteGroup = function (shopid, groupid, success, error) {
        var resource = $resource(merchanturl + "shopgroup/:groupid/:shopid");
        return resource.remove({groupid: groupid, shopid: shopid}, success, error);
    }
}